home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d11 / ev678dev.arc / DUMPMODE.PAS < prev    next >
Pascal/Delphi Source File  |  1990-07-03  |  9KB  |  306 lines

  1. {-----------------------------------------------------------------------}
  2. { Program to get from the BIOS and any EV-678 mode TSR present a list   }
  3. { of all of the modes supported for a particular monitor.  It also    }
  4. { reads the state of the board.  It does this by calling the two     }
  5. { Everex Extended BIOS functions below:                    }
  6. {-----------------------------------------------------------------------}
  7. {    bx = 00h: return emulation status                }
  8. {        - cl = monitor type                    }
  9. {        - ch (b0)   = 6845 emulation                }
  10. {        -    (b1,3) = unused (0)                }
  11. {        -    (b4)   = VGA Protect enabled            }
  12. {        -    (b5)   = 44.9MHz present                }
  13. {        -    (b6,7) = 256K/512K/1024K/2048K            }
  14. {        - dx = BCD board id (b15..b4: model, b3..b0: revision)    }
  15. {        - di = BCD BIOS version number                }
  16. {-----------------------------------------------------------------------}
  17. {    bx = 05h: Get mode supported info for current            }
  18. {    Entry:    cl = Maximum number of modes to get info for        }
  19. {        dl = monitor type to get mode info for            }
  20. {        es:di -> buffer of sufficient size            }
  21. {        ch = Mode type to get info for:                }
  22. {           = 00h to get all modes                }
  23. {           = 01h to get mono text modes                }
  24. {           = 02h to get color text modes            }
  25. {           = 03h to get 4 color (CGA) grfx modes        }
  26. {           = 04h to get 1 color (CGA) grfx modes        }
  27. {           = 05h to get 16 color grfx modes            }
  28. {           = 06h to get 256 color grfx modes            }
  29. {        - cl = Total number of modes fitting criteria        }
  30. {        - ch = Size of each record                }
  31. {        Info record format:                    }
  32. {            (b) - Mode number (b7 set if it is an extended mode)}
  33. {            (b) - Mode format (same definition as ch above)    }
  34. {            (b) - Info bits                    }
  35. {                (b0) - paged mode            }
  36. {                (b1,2) Requires 256K/512K/1024K/2048K    }
  37. {                (b3) - Requires 44.9MHz            }
  38. {                (b4) - Interlaced mode            }
  39. {                (b5) - monochrome mode            }
  40. {                (b6.7) - reserved            }
  41. {            (b) - font height                }
  42. {            (b) - Columns on screen (text format)        }
  43. {            (b) - Rows on screen (text format)        }
  44. {            (w) - Number of scan lines            }
  45. {            (b) - Color info                }
  46. {                (b0.3) Bits per pixel            }
  47. {                (b4.7) reserved (0)            }
  48.  
  49. {    bx = 05h: Get mode supported info for current            }
  50. {    Entry:    cl = Maximum number of modes to get info for        }
  51. {        dl = monitor type to get mode info for            }
  52. {        es:di -> buffer of sufficient size            }
  53. {        ch = Mode type to get info for:                }
  54. {           = 00h to get all modes                }
  55. {           = 01h to get mono text modes                }
  56. {           = 02h to get color text modes            }
  57. {           = 03h to get 4 color (CGA) grfx modes        }
  58. {           = 04h to get 16 color grfx modes            }
  59. {           = 05h to get 256 color grfx modes            }
  60. {        - cl = Total number of modes fitting criteria        }
  61. {        - ch = Size of each record                }
  62. {        Info record format:                    }
  63. {            (b) - Mode number (b7 set if it is an extended mode)}
  64. {            (b) - Mode format (same definition as ch above)    }
  65. {            (b) - Info bits                    }
  66. {                (b0) - paged mode            }
  67. {                (b1,2) Requires 256K/512K/1024K/2048K    }
  68. {                (b3) - Requires 44.9MHz            }
  69. {                (b4) - Interlaced mode            }
  70. {                (b5) - monochrome mode            }
  71. {                (b6.7) - reserved            }
  72. {            (b) - font height                }
  73. {            (b) - Columns on screen (text format)        }
  74. {            (b) - Rows on screen (text format)        }
  75. {            (w) - Number of scan lines            }
  76. {            (b) - Color info                }
  77. {                (b0.3) - Bits per color            }
  78. {                (b4.7) - reserved (0)            }
  79. {-----------------------------------------------------------------------}
  80.  
  81. uses
  82.     dos;
  83.  
  84. {-----------------------------------------------------------------------}
  85.  
  86. type
  87.     s64 = string[64];
  88.  
  89.     Ev678ModeInfoType = record
  90.         mode    : byte;
  91.     memorg    : byte;
  92.     info    : byte;
  93.     points  : byte;
  94.     columns : byte;
  95.     rows    : byte;
  96.     scanline: word;
  97.     color    : byte;
  98.     end;
  99.  
  100. {-----------------------------------------------------------------------}
  101.  
  102. const
  103.     MonitorType : array [$00..$07] of s64 = 
  104.        ('Monochrome',
  105.         'CGA',
  106.     'EGA',
  107.     'TTL multifrequency',
  108.     'IBM PS/2 fixed frequency',
  109.     'IBM 8514 fixed frequency',
  110.     'Analog multifrequency',
  111.     'Analog multifrequency');
  112.  
  113.     EmulationType : array [$00..$01] of s64 = 
  114.        ('Standard VGA',
  115.         '6845 emulation');
  116.  
  117.     MemorySizeType : array [$00..$03] of s64 = 
  118.        (' 256K',
  119.         ' 512K',
  120.     '1024K',
  121.     '2048K');
  122.  
  123.     ProtectType : array [$00..$01] of s64 = 
  124.        ('VGA registers unprotected',
  125.         'VGA registers protected');
  126.  
  127.     CrystalPresentType : array [$00..$01] of s64 = 
  128.        ('44.9MHz crystal not present',
  129.         '44.9MHz crystal present');
  130.  
  131.     MemoryOrgType : array [$00..$08] of s64 = 
  132.        ('Invalid  ',
  133.         'Mono Txt ',
  134.         'Colr Txt ',
  135.         '4 Grfx   ',
  136.         '2 Grfx   ',
  137.         'Planar   ',
  138.         '256 Grfx ',
  139.     'Unknown  ',
  140.     'Unknown  ');
  141.  
  142.     CrystalNeededType : array [$00..$01] of s64 = 
  143.        ('       ',
  144.         '44.9MHz');
  145.  
  146.     InterlacedType : array [$00..$01] of s64 = 
  147.        ('       ',
  148.         'intrlcd');
  149.  
  150.     PagedType : array [$00..$01] of s64 = 
  151.        ('     ',
  152.         'paged');
  153.  
  154.     ColorMonoType : array [$00..$01] of s64 = 
  155.        ('C',
  156.         'M');
  157.  
  158. {-----------------------------------------------------------------------}
  159.  
  160. var
  161.     reg     : Registers;
  162.     i       : byte;
  163.  
  164.     modeptr : ^Ev678ModeInfoType;
  165.     indxptr : ^Ev678ModeInfoType;
  166.     modesize: byte;
  167.     modenum : byte;
  168.     modeind : byte;
  169.  
  170. {-----------------------------------------------------------------------}
  171. {-----------------------------------------------------------------------}
  172.  
  173. function decval(decnum : real) : s64;
  174.  
  175. const table : array [0..15] of char = ('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
  176.  
  177. begin
  178.     decval := table[trunc(decnum)];
  179. end;
  180.  
  181. function dectohex(decnum : real) : s64;
  182.  
  183. begin
  184.     if decnum >= 16.0 then begin
  185.         dectohex := dectohex(decnum/16) + decval(decnum - 16.0*trunc(decnum/16.0));
  186.     end else
  187.         dectohex := decval(decnum);
  188. end;
  189.  
  190. function hex(decnum : real) : s64;
  191.  
  192. var i : byte;
  193.     tmp : s64;
  194.  
  195. begin
  196.     tmp := dectohex(decnum);
  197.     for i := 1 to 2-Length(tmp) do
  198.         tmp := '0'+tmp;
  199.     tmp := tmp+'h';
  200.     hex := tmp;
  201. end;
  202.  
  203. {-----------------------------------------------------------------------}
  204. {-----------------------------------------------------------------------}
  205.  
  206. begin
  207.     reg.AX := $7000;
  208.     reg.BX := $0000;        { Get card info }
  209.     Intr($10,reg);
  210.  
  211.     if (reg.AL<>$70) then begin
  212.         writeln('Everex Extended BIOS calls not supported.');
  213.     halt(1);
  214.     end;
  215.     if ((reg.DX and $FFF0)=$6730) then begin
  216.         writeln('Everex EVGA (EV673) does not support mode info function.');
  217.     halt(1);
  218.     end;
  219.  
  220.     write('Adapter     : EV-');
  221.     for i := 0 to 2 do begin
  222.         write(chr(((reg.DX shr $0C) and $0F) + ord ('0')));
  223.         reg.DX := reg.DX shl $04;
  224.     end;
  225.     writeln;
  226.  
  227.     write('BIOS Version: v');
  228.     for i := 0 to 2 do begin
  229.         reg.DI := reg.DI shl $04;
  230.         write(chr(((reg.DI shr $0C) and $0F) + ord ('0')));
  231.     if (i=0) then
  232.         write('.');
  233.     end;
  234.     writeln;
  235.  
  236.     writeln('Monitor Type: ',MonitorType[reg.cl]);
  237.     writeln('Emulation   : ',EmulationType[reg.ch and $01]);
  238.     writeln('Memory Size : ',MemorySizeType[(reg.ch shr 6) and $03]);
  239.     writeln('Protection  : ',ProtectType[(reg.ch shr 4) and $01]);
  240.     writeln('44.9MHz     : ',CrystalPresentType[(reg.ch shr 5) and $01]);
  241.  
  242.     reg.AX := $7000;
  243.     reg.BX := $0005;        { Get mode info }
  244.     reg.DL := reg.CL;        { Get mode info for current monitor }
  245.     reg.CL := $00;        { Get 00 modes on the first call }
  246.     reg.CH := $00;        { Get all modes }
  247.     Intr($10,reg);
  248.  
  249.     modenum := reg.CL;        { Get total number of modes }
  250.     modesize:= reg.CH;        { Get size of each record }
  251.  
  252.     GetMem(modeptr,modenum*modesize);
  253.  
  254.     reg.AX := $7000;
  255.     reg.CH := $00;        { Get all modes }
  256.     reg.ES := Seg(modeptr^);
  257.     reg.DI := Ofs(modePtr^);
  258.     Intr($10,reg);        { Get all mode info }
  259.  
  260.     for modeind := 0 to modenum-1 do begin
  261.     
  262.         indxptr := Ptr(Seg(modeptr^),Ofs(modeptr^)+modeind*modesize);
  263.  
  264.     with indxptr^ do begin
  265.         if(mode>=$80) then
  266.             write('x')
  267.         else
  268.             write(' ');
  269.         write(hex(mode and $7F),' ');
  270.         
  271.         write(MemoryOrgType[memorg],' ');
  272.         
  273.         write(columns:3,'x');
  274.         
  275.         write(rows:2,' ');
  276.         
  277.         if ((points and $80) = $80) then
  278.             write('9')
  279.         else
  280.             write('8');
  281.         write('x',(points and $3F):2,' ');
  282.         
  283.         if ((points and $80) = $80) then
  284.             write(9*columns:4)
  285.         else
  286.             write(8*columns:4);
  287.         write('x',scanline:3);
  288.         write('x',(color and $0F):1,' ');
  289.         
  290.         write(ColorMonoType[(info shr 5) and $01],' ');
  291.         write(MemorySizeType[(info shr 1) and $03],' ');
  292.         write(CrystalNeededType[(info shr 3) and $01],' ');
  293.         write(PagedType[info and $01],' ');
  294.         write(InterlacedType[(info shr 4) and $01],' ');
  295.  
  296.     end; {with}
  297.         
  298.     writeln;
  299.  
  300.     end; {for}
  301.  
  302. end.
  303.  
  304. {-----------------------------------------------------------------------}
  305. {-----------------------------------------------------------------------}
  306.